package com.siqi.hr.system.custom.entity;

import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 角色实体操作关系对象
 * @author    xiaogq
 * Created by xiaogoingqin on 2016/7/24.
 */
public class EntityRoleOperation {
    /**
     * 主键id
     */
    private int id;

    /**
     * 角色id
     */
    private String roleId;

    /**
     * 实体id
     */
    private int entityId;

    /**
     * 操作id
     */
    private String operationId;

    /**
     * 操作对应js方法
     */
    private String method;

    /**
     * 操作对应url
     */
    private String url;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getRoleId() {
        return roleId;
    }

    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }

    public String getOperationId() {
        return operationId;
    }

    public void setOperationId(String operationId) {
        this.operationId = operationId;
    }

    public int getEntityId() {
        return entityId;
    }

    public void setEntityId(int entityId) {
        this.entityId = entityId;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    /**
     * 查询所有操作
     * @date 07 24, 2016
     */
    public static class getAllRoleOperation extends EntityRoleOperation implements RowMapper<EntityRoleOperation> {
        public EntityRoleOperation mapRow(ResultSet rs, int rowNum) throws SQLException {
            EntityRoleOperation opt = new EntityRoleOperation();
            opt.setId(rs.getInt("id"));
            opt.setRoleId(rs.getString("role_id"));
            opt.setEntityId(rs.getInt("entity_id"));
            opt.setOperationId(rs.getString("operation_id"));
            opt.setMethod(rs.getString("method"));
            opt.setUrl(rs.getString("url"));
            return opt;
        }
    }

}
